package com.change.declare.declare.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.change.declare.declare.entity.OrderitemcategoriesEntity;
import com.change.declare.declare.service.OrderitemcategoriesService;
import com.change.common.utils.PageUtils;
import com.change.common.utils.R;



/**
 * 
 *
 * @author LK
 * @email hmscrdlk@gmail.com
 * @date 2020-07-11 23:05:53
 */
@RestController
@RequestMapping("declare/orderitemcategories")
public class OrderitemcategoriesController {
    @Autowired
    private OrderitemcategoriesService orderitemcategoriesService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("declare:orderitemcategories:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderitemcategoriesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("declare:orderitemcategories:info")
    public R info(@PathVariable("id") Long id){
		OrderitemcategoriesEntity orderitemcategories = orderitemcategoriesService.getById(id);

        return R.ok().put("orderitemcategories", orderitemcategories);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("declare:orderitemcategories:save")
    public R save(@RequestBody OrderitemcategoriesEntity orderitemcategories){
		orderitemcategoriesService.save(orderitemcategories);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("declare:orderitemcategories:update")
    public R update(@RequestBody OrderitemcategoriesEntity orderitemcategories){
		orderitemcategoriesService.updateById(orderitemcategories);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("declare:orderitemcategories:delete")
    public R delete(@RequestBody Long[] ids){
		orderitemcategoriesService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
